package org.basis.algorithm.bitoperation;

/**
 * 位运算交换两个数
 *
 * @author Mr_wenpan@163.com 2021/12/02 16:00
 */
public class BitOperationSwitch {

    public static void main(String[] args) {
        final int i = 10;
        final int j = 100;
        exchange(i, j);
        System.out.println("i=" + i + ", j=" + j);

    }

    private static void exchange(int i, int j) {
        i = i ^ j;
        j = i ^ j;
        i = i ^ j;
        System.out.println("i=" + i + ", j=" + j);
    }
}
